package com.zxy.ziems.server.gasification.service.impl;

import com.zxy.ziems.server.dto.DataQueryDto;
import com.zxy.ziems.server.energy.service.DataChartDictService;
import com.zxy.ziems.server.gasification.service.GasificationService;
import com.zxy.ziems.server.vo.ChartVo;
import com.zxy.ziems.server.vo.ChartYAxisVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Copyright (C),
 * @ClassName: GasificationServiceImpl
 * @Author: yanzhiwei
 * @Description:
 * @Date: 2024/6/11 15:38
 */
@Service
public class GasificationServiceImpl implements GasificationService {
    @Autowired
    private DataChartDictService dataChartDictService;

    @Override
    public ChartVo compressedAir(DataQueryDto dataQueryDto) {

        // 用量
        ChartVo chartVo1 = dataChartDictService.compareBarChart(dataQueryDto);

        // 费用
        ChartVo chartVo2 = dataChartDictService.compareBarChart(dataQueryDto);


        List<ChartYAxisVo> yAxisList = new ArrayList<>();
        yAxisList.addAll(chartVo1.getYAxisList());
        yAxisList.addAll(chartVo2.getYAxisList());
        ChartVo chartVo = new ChartVo();
        chartVo.setXAxisList(chartVo1.getXAxisList());
        chartVo.setYAxisList(yAxisList);

        return chartVo;
    }
}
